﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MoneyManagerNET.Presentation.ViewModel
{
    using Model;
    using System.Windows.Input;
    using MoneyManagerNET.Presentation.ViewModel.Base;
    public class RelocateContragentViewModel : ViewModelBase
    {
        public RelocateContragentViewModel()
        {
            SelectFromContragentCommand = new Infrastructure.DelegateCommand((o) => PromptFromContragent());
            SelectToContragentCommand = new Infrastructure.DelegateCommand((o) => PromptToContragent());
        }

        IContragent _toContragent;

        public IContragent ToContragent
        {
            get { return _toContragent; }
            set { _toContragent = value; this.OnChange(() => ToText); }
        }

      
        IContragent _fromContragent;

        public IContragent FromContragent
        {
            get { return _fromContragent; }
            set { _fromContragent = value; this.OnChange(() => FromText); }
        }


        public string FromText { get { return FromContragent == null ? "select source payer" : FromContragent.Name ; } }

        public string ToText { get { return ToContragent == null ? "select destination payer" : ToContragent.Name; } }


        public ICommand SelectFromContragentCommand { get; protected set;}
        public void PromptToContragent()
        {
            var cvm = new Presentation.ViewModel.ContragentListViewModel();
            ToContragent =cvm.PromptSelect();
        }


        public ICommand SelectToContragentCommand { get; protected set; }
        public void PromptFromContragent()
        {
            var cvm = new Presentation.ViewModel.ContragentListViewModel();
            FromContragent = cvm.PromptSelect();
        }

    }
}
